<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
	<input type="text" id="t">
	<input type="button" id="btn" value="发送请求">
	<h1 id="div"></h1>
	<a href="index.jsp">超链接</a>
	<script>
		document.getElementById("btn").onclick = function(){
			let xhr = new XMLHttpRequest();
			xhr.onreadystatechange = function(){
				if(xhr.readyState == 4){
				if(xhr.status == 200){
					document.getElementById("div").innerHTML = xhr.responseText;
				}
			}
			}
			let name = document.getElementById("t").value;
		xhr.open("GET","helloServlet.let?name="+name,true);
		xhr.send();
		}
	</script>
	</body>
</html>